#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 105;

int n, m;
int dep[N], mx;
vector<int> ch[N];
void dfs(int u, int fu) {
  if (u) dep[u] = dep[fu] + 1;
  mx = max(mx, dep[u]);
  for (int v : ch[u]) {
    if (v == fu) continue;
    dfs(v, u);
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 2, n) {
    int u, v;
    cin >> u >> v;
    ch[u].push_back(v);
    ch[v].push_back(u);
  }
  dfs(0, 0);
  if (m <= mx)
    cout << m + 1;
  else if (mx + m >= (n - 1) * 2)
    cout << n;
  else
    cout << 1 + (m + mx) / 2;
  return 0;
}